Release 10.1A: OpenEdge Data Management:
SQL Reference


DECODE

Compares the value of the first argument expression with each search_expression and, if a match is found, returns the corresponding match_expression. If no match is found, then the function returns the default_expression. If a default_expression is not specified and no match is found, the function returns a NULL value.

Syntax

DECODE ( expression, search_expression, match_expression
   [ , search_expression, match_expression ...]
   [ , default_expression ] ) 

Example

This example illustrates one way to use the DECODE function:

SELECT ename, DECODE (deptno, 
             10, 'ACCOUNTS', 
             20, 'RESEARCH', 
             30, 'SALES', 
             40, 'SUPPORT', 
             'NOT ASSIGNED' 
          ) 
   FROM employee ; 

Notes

Compatibility

Progress extension


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095